const connection = require("../db/connection");

function checkProductExist(name){
    connection.query("SELECT * FROM product where 名称=?",[name], function(error, products){
        if(error){
            console.log("查找全部商品信息失败!", error);
            process.exit(1);
        }

        if(products.length <= 0){
            console.log("\033[31m不存在该商品\033[0m");
            process.exit(2);
        }
    });
}

module.exports = checkProductExist;